var constant = {
    0: "success",

    //1000-1999 系统错误
    1000: "token无效",
    1001: "param无效",
    1002: "redis错误",
    1003: "mysql错误",
    1004: "socket错误",
    1005: "请求频繁",
    1006: "无可用的game服务器",
    1007: "game服务器访问错误",
    1008: "无可用的redis缓存",
    1009: "缺少必传参数",

    //2000-2999 逻辑错误
    2001: "game服务器注册错误",
    2002: "房间号生成错误",
    2003: "房间不存在",
    2004: "房间人数已满",

    //3000-3999 游戏错误
};

exports.constant = constant;

const CODE_ERROR = -1;
const CODE_SUCCESS = 0;
const CODE_TOKEN_INVALID = 1000;
const CODE_PARAM_INVALID = 1001;
const CODE_REDIS_ERROR = 1002;
const CODE_REDIS_EMPTY_ERROR = 1008;

const CODE_MYSQL_ERROR = 1003;
const CODE_SOCKET_ERROR = 1004;
const CODE_REQUEST_MUCH = 1005;
const CODE_GAMESERVER_ERROR = 1006;
const CODE_REQUEST_ERROR = 1007;
const CODE_REQUEST_USERID_ERROR = 1009

const CODE_REGISTER_SERVER_ERROR = 2001;
const CODE_ROOMNO_ERROR = 2002;
const CODE_ROOM_NULL_ERROR = 2003;
const CODE_ROOM_ENOUGT_ERROR = 2004;

exports.CODE_ERROR = CODE_ERROR
exports.CODE_SUCCESS = CODE_SUCCESS;

exports.CODE_TOKEN_INVALID = CODE_TOKEN_INVALID;
exports.CODE_PARAM_INVALID = CODE_PARAM_INVALID;
exports.CODE_REDIS_ERROR = CODE_REDIS_ERROR;
exports.CODE_REDIS_EMPTY_ERROR = CODE_REDIS_EMPTY_ERROR;

exports.CODE_MYSQL_ERROR = CODE_MYSQL_ERROR;
exports.CODE_SOCKET_ERROR = CODE_SOCKET_ERROR;
exports.CODE_REQUEST_MUCH = CODE_REQUEST_MUCH;
exports.CODE_GAMESERVER_ERROR = CODE_GAMESERVER_ERROR;
exports.CODE_REQUEST_ERROR = CODE_REQUEST_ERROR;
exports.CODE_REQUEST_USERID_ERROR = CODE_REQUEST_USERID_ERROR;

exports.CODE_REGISTER_SERVER_ERROR = CODE_REGISTER_SERVER_ERROR;
exports.CODE_ROOMNO_ERROR = CODE_ROOMNO_ERROR;
exports.CODE_ROOM_NULL_ERROR = CODE_ROOM_NULL_ERROR;
exports.CODE_ROOM_ENOUGT_ERROR = CODE_ROOM_ENOUGT_ERROR;
